#ifndef classEK270H
 #define classEK270H

 #include <stdio.h>
 #include "PrimitivesEK270.h"
 #include "CPU_const.h"


#define EK_270        270
#define EK_260        260
#define EK_TYPE     ( EK_270 )







/****************************************************************************************************/
/*                              L O W L E V E L     D E F I N E                                     */
/*                               ( d o n ' t     c h a n g e )                                      */
/****************************************************************************************************/
 #define strSize      49

 #define TimeOutCmmn  1500//
 #define TimeOutArch  3500//




/****************************************************************************************************/
/****************************************************************************************************/


/****************************************************************************************************/
/*                          E K 2 7 0   A D D R E S S   C O N S T S                                 */
/*                               ( d o n ' t     c h a n g e )                                      */
/****************************************************************************************************/
 #define StSL_adr         31700  //
 #define StCL_adr         41700  //
 #define CodSL_adr        31710  //
 #define CodCL_adr        41710  //
//
 #define VbT_adr          23022  //
 #define Vo_adr           43022  //
 #define p_adr            73101  //
 #define T_adr            63101  //
//GAS passport addresses of EK260
 #define CO2_a260        113110  //
 #define H2_a260         123110  //
 #define Rhoc_a260       133110  //
 #define N2_a260         143110  //
 #define dv_a260         153110  //
//GAS passport addresses of EK270
 #define CO2_a270        113140  //
 #define H2_a270         123140  //
 #define Rhoc_a270       133140  //
 #define N2_a270         143140  //
 #define dv_a270         153140  //
//
 #define Time_adr         14002  //




/****************************************************************************************************/
/****************************************************************************************************/






class EK270
{
  char Z, sumXOR, str[strSize], Atribute;
  uint codSL, codCL, statSL, statCL;
  UARTbuf *pUx;
  EKdata ArchData;
  
  
private:  
//
  void setID(void);
  bool askEK(portTickType xTicksToWait);
  void formBREAK(void);
  void formREQUEST(void);
  void formACK(char u, char y);
  void formR1(uint Adr, usht NofPar);
  void formR3arch(char NofArch, DataTime *pBgn, char NofStr);
  void formW1(uint Adr);
  void wrChar(char simbol);
  void wrString(char *pSTR);
  void wrUShort(usht num);
  void wrDataTime(DataTime *pDT);
  void wrDTval(char DTval);
  void ParamSet(char col);
  void StrToDataTime(DataTime *pDT);
  char StrToChar(uint StrShft);
  bool check_Answer(portTickType xTicksToWait);
//  
public:
//
  EK270(UARTbuf *pUART);
  EK270(UARTbuf *pUART, uint CodSL, uint CodCL);
  void setCodSL(uint CodSL);
  void setCodCL(uint CodCL);
  
  
  bool GetCurrentParameters(EKdata *pCurrData);
  bool GetGasPassport(GASpassport *pGAS);
  bool GetArMP(DataTime *pRecordTime, EKdata *pArData);
  bool GetArDay(DataTime *pRecordTime, EKdata *pArData);
  
  float PutCO2(float CO2percent);
  float PutH2(float H2percent);
  float PutRhoc(float RhocVal);
  float PutN2(float N2percent);
  float PutAnyoneParameter(uint Adr, float Param);
  
  bool startEK(void);
  bool finishEK(void);
  bool OpenSLcastle(void);
  bool OpenCLcastle(void);
  bool CloseSLcastle(void);
  bool CloseCLcastle(void);
  bool getPARAMfl(uint Adr, float *pParam);
  bool getPARAMdt(uint Adr, DataTime *pDT);
  bool getPARAMui(uint Adr, uint *pParam);
  bool putPARAMui(uint Adr, uint Param);
  bool putPARAMuiHex(uint Adr, uint Param);
  bool putPARAMfl(uint Adr, float Param);
  
  bool getArch(DataTime *pBgn, char NofStr, char NofArh);
  
//
};
/****************************************************************************************************/
/****************************************************************************************************/



#endif